Before learning how to spray paint in reality I have looked into different ideas that people from around the world are using to simulate a spray paint effect in Flash. There are a number of people that show their ideas and post their code for anyone to use, and this has been very helpful.
The most predominant method of creating a simulated spray painting effect is to draw a circle on the screen that has a number of dots inside it. After drawing the dots a blur effect is added to smooth things out a bit.
i have a good idea i not says in this lenguague I HATEEEEEEEEEEEEEEEEE YOUUUUUUUUUUUUU GUYYYYYYYYYYYYYYYS PLAYNG THE GAMEEEEEEEEEEE
The application works really well - even holding the spray can in one spot causes the paint to pool and then run, perfect! When drawing at any speed the line is unbroken and it looks similar to what I think spray painting should look like (I will learn more about what spray painting looks like when we go for our lesson).
After using Freedraw for a while I realised that it wasn't doing a beautifully efficient programmed version of the "blurred, twisting circle" it was just a large, blurred line.
Well that's easy! I thought...
Flash Player 7 does not support ActionScript 3. This is the latest version of ActionScript and it is quite powerful and would be the perfect choice to write this application. Unfortunately it is necessary to use Actionscript 2 as this was made available on the release of Flash Player 7, the player available on the Wii.
Here is the code that was used to create the "blurred line" spray effect in ActionScript 2.
this.createEmptyMovieClip("draw_mc", 1);
import flash.filters.BlurFilter;
var blurX:Number = 10;
var blurY:Number = 10;
varquality:Number = 3;
var filter:BlurFilter = new BlurFilter(blurX, blurY, quality);
var filterArray:Array = newArray();
filterArray.push(filter);
var fanSize = 40_root.onMouseDown = function(){this.onEnterFrame = function(){with(draw_mc){lineStyle(fanSize, 0x333333, 100);
curveTo(this._xmouse, this._ymouse, this._xmouse, this._ymouse);
filters = filterArray;
}}this.onMouseUp = function(){this.onEnterFrame = null}}
And here is the result:
It works? Well it does if you publish the Flash file to work with Flash Player 8 and above. Unfortunately, Flash Player 7 does not understand what a blur filter is.
So, what next?
After thinking about it, a blur is really just a number of lines overlapping a bit with darker lines in the center, so why not just draw a series of lines that overlap like this:
Here is the code, in ActionScript 2 that works in Flash Player 7, though again unfortunately, it starts to run slowly after a while and it becomes noticeably ... blocky. There is some room for improvement (though a number of other things will need to happen at the same time as well as just this code, ie timers to trigger paint runs etc). Adjusting the frame rate higher makes the line smoother but it locks up quicker, here is the first attempt:
And here is the result, much blockier than the first result above that I think is on a par with the Freedraw site.
It was starting to become clear that we weren't going to be able to produce a nice spray painting effect in Flash PlOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOIIIIO
Spray painting trials
Before learning how to spray paint in reality I have looked into different ideas that people from around the world are using to simulate a spray paint effect in Flash. There are a number of people that show their ideas and post their code for anyone to use, and this has been very helpful.The most predominant method of creating a simulated spray painting effect is to draw a circle on the screen that has a number of dots inside it. After drawing the dots a blur effect is added to smooth things out a bit.
i have a good idea i not says in this lenguague I HATEEEEEEEEEEEEEEEEE YOUUUUUUUUUUUUU GUYYYYYYYYYYYYYYYS PLAYNG THE GAMEEEEEEEEEEE
The application works really well - even holding the spray can in one spot causes the paint to pool and then run, perfect! When drawing at any speed the line is unbroken and it looks similar to what I think spray painting should look like (I will learn more about what spray painting looks like when we go for our lesson).
After using Freedraw for a while I realised that it wasn't doing a beautifully efficient programmed version of the "blurred, twisting circle" it was just a large, blurred line.
Well that's easy! I thought...
Flash Player 7 does not support ActionScript 3. This is the latest version of ActionScript and it is quite powerful and would be the perfect choice to write this application. Unfortunately it is necessary to use Actionscript 2 as this was made available on the release of Flash Player 7, the player available on the Wii.
Here is the code that was used to create the "blurred line" spray effect in ActionScript 2.
And here is the result:
It works? Well it does if you publish the Flash file to work with Flash Player 8 and above. Unfortunately, Flash Player 7 does not understand what a blur filter is.
So, what next?
After thinking about it, a blur is really just a number of lines overlapping a bit with darker lines in the center, so why not just draw a series of lines that overlap like this:Here is the code, in ActionScript 2 that works in Flash Player 7, though again unfortunately, it starts to run slowly after a while and it becomes noticeably ... blocky. There is some room for improvement (though a number of other things will need to happen at the same time as well as just this code, ie timers to trigger paint runs etc). Adjusting the frame rate higher makes the line smoother but it locks up quicker, here is the first attempt:
And here is the result, much blockier than the first result above that I think is on a par with the Freedraw site.
It was starting to become clear that we weren't going to be able to produce a nice spray painting effect in Flash PlOO